import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class p5727 {
    public static void main(String[] args) {
        //TIP 当文本光标位于高亮显示的文本处时按 <shortcut actionId="ShowIntentionActions"/>
        // 查看 IntelliJ IDEA 建议如何修正。
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        List<Integer> sequence= new ArrayList<>();
        int current = n;
        while (current != 1) {
            sequence.add(current);
            if(current%2==1){
                current=current*3+1;
            }
            else{
                current=current/2;
            }
        }
        sequence.add(current);
        scanner.close();
        for(int i=sequence.size()-1;i>=0;i--){
            System.out.print(sequence.get(i)+" ");
        }
    }
}
